-- PlayFab <%- api.name %> API
-- This is the main file you should require in your game
-- All api calls are documented here: https://docs.microsoft.com/gaming/playfab/api-references/
-- Example code:
-- local PlayFab<%- api.name %>Api = require("<%- requirePrefix %>PlayFab<%- api.name %>Api")
-- PlayFab<%- api.name %>Api.<<%- api.name %>ApiCall>(request, successCallbackFunc, errorCallbackFunc)

local IPlayFabHttps = require("<%- requirePrefix %>IPlayFabHttps")
local PlayFabSettings = require("<%- requirePrefix %>PlayFabSettings")

local PlayFab<%- api.name %>Api = {
    settings = PlayFabSettings.settings
}
<% if (hasClientOptions) { %>
function PlayFabClientApi.IsClientLoggedIn()
    return (not (PlayFabSettings._internalSettings.sessionTicket == nil))
end

function PlayFabClientApi._MultiStepClientLogin(needsAttribution)
    if (needsAttribution and not PlayFabSettings.settings.disableAdvertising and PlayFabSettings.settings.advertisingIdType and PlayFabSettings.settings.advertisingIdValue) then
        local request = {}
        if (PlayFabSettings.settings.advertisingIdType == PlayFabSettings.settings.AD_TYPE_IDFA) then
            request.Idfa = PlayFabSettings.settings.advertisingIdValue
        elseif (PlayFabSettings.settings.advertisingIdType == PlayFabSettings.settings.AD_TYPE_ANDROID_ID) then
            request.Adid = PlayFabSettings.settings.advertisingIdValue
        else
            return
        end
        PlayFabClientApi.AttributeInstall(request, nil, nil)
    end
end
<% }
for (var c in api.calls) { var apiCall = api.calls[c]; %>
<%- generateApiSummary("", apiCall, "summary")
%>function PlayFab<%- api.name %>Api.<%- apiCall.name %>(request, onSuccess, onError)
<%- getRequestActions("    ", apiCall)
%>    IPlayFabHttps.MakePlayFabApiCall("<%- apiCall.url %>", request, <%- getAuthentication(apiCall) %>, onSuccess, onError)
end
<% } %>
return PlayFab<%- api.name %>Api
